package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.VO.OrderVO;
import com.itheima.pojo.CheckItem;
import com.itheima.pojo.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface OrderMapper {

    /**
     * 分页查询预约信息
     * @param queryString
     * @return
     */
    Page<OrderVO> pageQuery(String queryString);


    /**
     * 修改预约状态
     * @param OrderDTO
     * @return
     */
    @Update("update t_order set orderStatus = #{orderStatus} where id = #{id}")
    int updateOrderStatus(Order OrderDTO);


    @Select("select count(id) from t_order where orderDate = #{reportDate} and orderStatus = '已到诊'")
    Integer todayVisitsNumber(LocalDate reportDate);

    //本周到诊数
    @Select("select count(id) from t_order where orderDate between #{startDate} and #{endDate} and orderStatus = '已到诊'")
    Integer thisWeekVisitsNumber(LocalDate startDate,LocalDate endDate);
    //本月到诊数
    @Select("select count(id) from t_order where orderDate between #{startDate} and #{endDate} and orderStatus = '已到诊'")
    Integer thisMonthVisitsNumber(LocalDate startDate,LocalDate endDate);
}
